<!DOCTYPE HTML>
<html>
<body>
    <div style="width: 1000px; height: 1000px; position: absolute; top: 0; left: 0;"></div>
    <div style="width: 100px; height: 100px; position: absolute; top: 100px; left: 0; background: green"></div>
    <p>
        Test for <i><a href="rdar://problem/6643103">rdar://problem/6643103</a>
        Unscaled values from body.scrollHeight</i>.
    </p>
    <script src="../../resources/js-test.js"></script>
    <script>
        setPrintTestResultsLazily();

        var floatPrecision = 0.00001;
        function checkValue(actual, expected)
        {
            if (window.testRunner) {
               shouldBeCloseTo(actual, expected, floatPrecision);
            }
        }

        if (window.testRunner) {
            testRunner.dumpAsText();
            checkValue('document.scrollingElement.scrollHeight', 1000)
            checkValue('document.scrollingElement.scrollWidth', 1000);

            // Scrolling right to 40.
            document.scrollingElement.scrollLeft = 40;
            checkValue('document.scrollingElement.scrollLeft', 40);

            // Zooming in.
            testRunner.zoomPageIn();
            checkValue('document.scrollingElement.scrollHeight', 1000);
            checkValue('document.scrollingElement.scrollWidth', 1000);
            checkValue('document.scrollingElement.scrollTop', 0);
            checkValue('document.scrollingElement.scrollLeft', 40);

            // Scrolling down to 100.
            document.scrollingElement.scrollTop = 100;
            checkValue('document.scrollingElement.scrollTop', 100);

            // Zooming back out.
            testRunner.zoomPageOut();
            checkValue('document.scrollingElement.scrollTop', 100);
            checkValue('document.scrollingElement.scrollLeft', 40);
        }
    </script>
</body>
</html>
